import Vue from 'vue'
import App from './App'
import VueI18n from 'vue-i18n'
import http from './utils/http.js'
import utils from './utils/index.js'
Vue.config.productionTip = false

Vue.use(VueI18n)

const i18n = new VueI18n({  
  locale: 'zh-CN',  // 默认选择的语言
      messages: {
        'zh-CN': require('./common/lang/zh'),   // 中文语言包
        'en-US': require('./common/lang/en')    // 英文语言包
      }
})
Vue.prototype._i18n = i18n;

App.mpType = 'app'
Vue.prototype.$uploadImg = http.uploadImg
Vue.prototype.$http = http.request
Vue.prototype.$utils = {
	... utils
}

Vue.prototype.isBarHeight999 = function () {
	return new Promise((resolve, reject) => {
		var that = this
		var isTemp = {}
		uni.getSystemInfo({
			success(res) {
				let totalTopHeight = 68
				if (res.model.indexOf('iPhone X') !== -1) {
					totalTopHeight = 88
				} else if (res.model.indexOf('iPhone') !== -1) {
					totalTopHeight = 64
				}
				isTemp['statusBarHeight'] = res.statusBarHeight
				isTemp['titleBarHeight'] = totalTopHeight - res.statusBarHeight
				isTemp['allHeight'] = totalTopHeight
				resolve(isTemp.statusBarHeight)
			},
			fail(e) {
				reject(e)
			}
		})
	})
}
const app = new Vue({
	i18n,
    ...App
})
app.$mount()
